package com.zhou.cloud.config;

import com.zhou.cloud.entry.DemoHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @descrition: 分布式锁配置
 * @author: zhouyongjun
 * @date: 2022/11/28
 **/
@Configuration
public class LockConfig {




    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean("lockHttpClient")
    public DemoHttpClient demoHttpClient() {
        return new DemoHttpClient("http://distributed-lock-service/",restTemplate());
    }
}
